Compilation as Partial Evaluation of Functor Category Semantics
نویسنده
چکیده
Our goal is to produce the same compiler as Reynolds 12] via partial evaluation. We develop a continuation semantics for a higher-order, imperative, call-by-name Algol-like language which is based on the functor category semantics of Reynolds and Oles 11], and compile programs via the rst Futumura projection. Our \compilation semantics" is non-standard in some ways (e.g., the meanings of expressions involve the use of temporary storage), although the meanings of terms are recognizably equivalent to their standard denotations. The target language is three address code as in the Dragon book, where the use of memory is explicit rather than implicit as with a stack machine. The presence of store shapes in our denotational description allows actual addresses of program variables to be used in the code, and also yields a very space-eecient method of handling temporary storage in the compilation of expressions. We improve upon Reynolds 12] by introducing jumps and labels in the compilation of conditional statements, thereby eliminating tree-structured machine code and code duplication. Our experiment was inspired by Danvy and Vestergaard 3], and we improve upon their result in that our interpreter is a high-level denotational deenition for the language.
منابع مشابه
Modelling Local Variables: Possible Worlds and Object Spaces
Local variables in imperative languages have been given denotational semantics in at least two fundamentally different ways. One is by use of functor categories, focusing on the idea of possible worlds. The other might be termed event-based, exemplified by Reddy’s object spaces and models based on game semantics. O’Hearn and Reddy have related the two approaches by giving functor category model...
متن کاملAxiomatic Constructor Classes in Isabelle/HOLCF
We have definitionally extended Isabelle/HOLCF to support axiomatic Haskell-style constructor classes. We have subsequently defined the functor and monad classes, together with their laws, and implemented state and resumption monad transformers as generic constructor class instances. This is a step towards our goal of giving modular denotational semantics for concurrent lazy functional programm...
متن کاملA Proposed Categorical Semantics for ML Modules
We present a simple categorical semantics for ML signatures, structures and functors. Our approach relies on realizablity semantics in the category of assemblies. Signatures and structures are modelled as objects in slices of the category of assemblies. Instantiation of signatures to structures and hence functor application is modelled by pullback.
متن کاملOn exact category of $(m, n)$-ary hypermodules
We introduce and study category of $(m, n)$-ary hypermodules as a generalization of the category of $(m, n)$-modules as well as the category of classical modules. Also, we study various kinds of morphisms. Especially, we characterize monomorphisms and epimorphisms in this category. We will proceed to study the fundamental relation on $(m, n)$-hypermodules, as an important tool in the study of a...
متن کاملNested Sketches
Since the fundamental work of Lawvere in 1963 [7] it is common to understand a theory as category with additional structure, to understand a model of the theory as a functor preserving the additional structure, and to represent homomorphisms by natural transformations. The resulting model category becomes a suitable subcategory of a functor category. Many different classes of mathematical struc...
متن کامل